% twoD_plot.m  2/14/2014  Parker MacCready
%
% plots the results of twoD_extractor.m

clear; close all
addpath('../alpha');
[Tdir] = toolstart;
infile = 'max_speed.nc';

lon = nc_varget(infile,'lon');
lat = nc_varget(infile,'lat');
max_speed = nc_varget(infile,'max_speed');
max_u = nc_varget(infile,'max_u');
max_v = nc_varget(infile,'max_v');
mab = nc_varget(infile,'mab');
mask = nc_varget(infile,'mask');
mab(~mask) = NaN;
H = nc_varget(infile,'H');
%
figure; Z_fig;
clims_pos = [0 1.5];
clims_neg = [-1.5 0];
aa = [-123.5 -122 47 49];
%
subplot(121)
Z_pcolorcen(lon,lat,real(max_speed));
caxis(clims_pos);
colorbar('southoutside')
Z_dar;
xlabel('Longitude'); ylabel('Latitude')
title('(a) Max near-bottom speed (m s^{-1})');
Z_addcoast('combined',Tdir.coast);
hold on
contour(lon,lat,H,[200 200],'r');
[xt,yt] = Z_lab('lr');
text(xt,yt,'200 m','color','r', ...
    'horizontalalignment','r','fontweight','bold')
%
subplot(122)
Z_pcolorcen(lon,lat,real(max_speed));
caxis(clims_pos);
axis(aa);
Z_dar;
xlabel('Longitude'); ylabel('Latitude')
title('(b) Close-up of Puget Sound');
Z_addcoast('combined',Tdir.coast);

set(gcf,'position',[10 10 1000 650]);
set(gcf,'PaperPositionMode','auto');
print('-djpeg100','max_speed.jpg');

%
% subplot(232)
% Z_pcolorcen(lon,lat,real(max_u));
% caxis(clims_pos);
% axis(aa);
% colorbar
% Z_dar;
% xlabel('Longitude'); ylabel('Latitude')
% title('Max near-bottom E-W speed (m s^{-1})');
%
% subplot(233)
% Z_pcolorcen(lon,lat,real(max_v));
% caxis(clims_pos);
% axis(aa);
% % colorbar
% Z_dar;
% xlabel('Longitude'); ylabel('Latitude')
% title('Max near-bottom N-S speed (m s^{-1})');
% %
% subplot(234)
% Z_pcolorcen(lon,lat,real(mab));
% caxis([0 20]);
% axis(aa);
% colorbar
% Z_dar;
% xlabel('Longitude'); ylabel('Latitude')
% title('meters-above-bottom of speed (m)');
% %
% subplot(235)
% Z_pcolorcen(lon,lat,real(min_u));
% caxis(clims_neg);
% axis(aa);
% colorbar
% Z_dar;
% xlabel('Longitude'); ylabel('Latitude')
% title('Min near-bottom E-W speed (m s^{-1})');
% %
% subplot(236)
% Z_pcolorcen(lon,lat,real(min_v));
% caxis(clims_neg);
% axis(aa);
% colorbar
% Z_dar;
% xlabel('Longitude'); ylabel('Latitude')
% title('Min near-bottom N-S speed (m s^{-1})');
% 
